; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=x86_64-linux-gnu -global-isel -verify-machineinstrs < %s -o - | FileCheck %s --check-prefix=CHECK

define i1 @trunc_i32toi1(i32 %a) {
; CHECK-LABEL: trunc_i32toi1:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl %edi, %eax
; CHECK-NEXT:    # kill: def $al killed $al killed $eax
; CHECK-NEXT:    retq
  %r = trunc i32 %a to i1
  ret i1 %r
}

define i8 @trunc_i32toi8(i32 %a) {
; CHECK-LABEL: trunc_i32toi8:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl %edi, %eax
; CHECK-NEXT:    # kill: def $al killed $al killed $eax
; CHECK-NEXT:    retq
  %r = trunc i32 %a to i8
  ret i8 %r
}

define i16 @trunc_i32toi16(i32 %a) {
; CHECK-LABEL: trunc_i32toi16:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movl %edi, %eax
; CHECK-NEXT:    # kill: def $ax killed $ax killed $eax
; CHECK-NEXT:    retq
  %r = trunc i32 %a to i16
  ret i16 %r
}

define i8 @trunc_i64toi8(i64 %a) {
; CHECK-LABEL: trunc_i64toi8:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movq %rdi, %rax
; CHECK-NEXT:    # kill: def $al killed $al killed $rax
; CHECK-NEXT:    retq
  %r = trunc i64 %a to i8
  ret i8 %r
}

define i16 @trunc_i64toi16(i64 %a) {
; CHECK-LABEL: trunc_i64toi16:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movq %rdi, %rax
; CHECK-NEXT:    # kill: def $ax killed $ax killed $rax
; CHECK-NEXT:    retq
  %r = trunc i64 %a to i16
  ret i16 %r
}

define i32 @trunc_i64toi32(i64 %a) {
; CHECK-LABEL: trunc_i64toi32:
; CHECK:       # %bb.0:
; CHECK-NEXT:    movq %rdi, %rax
; CHECK-NEXT:    # kill: def $eax killed $eax killed $rax
; CHECK-NEXT:    retq
  %r = trunc i64 %a to i32
  ret i32 %r
}

